package com.online.service_edu.controller;


import com.online.common_utils.ResultJson;
import com.online.service_edu.entity.treeSubject.OneLevelSubject;
import com.online.service_edu.service.EduSubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author hdc2008
 * @since 2021-02-09
 */
@RestController
@RequestMapping("/service_edu/edu-subject")
@CrossOrigin
public class EduSubjectController {

    @Autowired
    private EduSubjectService eduSubjectService;

    @PostMapping("excelSubject")
    public ResultJson improtExcelSubject(MultipartFile file) throws IOException {

        eduSubjectService.saveSubject(file,eduSubjectService);
        return ResultJson.ok();
    }

    @GetMapping("getSubList")
    public  ResultJson getSubList(){
        List<OneLevelSubject> subTreeList= eduSubjectService.getSubTreeData();

        return ResultJson.ok().data("data2",subTreeList);
    }

}

